<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta http-equiv="Pragma" content="no-cache" />
		<meta http-equiv="Cache-Control" content="no-cache" />
		<meta http-equiv="Expires" content="0" />
		<meta http-equiv="X-UA-Compatible" content="E=edge;chrome=1" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<title>嘉华金融</title>
        <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/reset.css">
	    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/weui.min.css">
	    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/index.css">
	    <script type="text/javascript" src="<%=path%>/static/js/common.js"></script>
	    <script type="text/javascript" src="<%=path%>/static/js/jquery-3.2.1.min.js"></script>
	    <script type="text/javascript" src="<%=path%>/static/layer/layer.js"></script>
	    <script type="text/javascript" src="<%=path%>/static/js/setBtnColor.js"></script>
    </head>
   <body>
  <div>
      <div class="header">
            <div><div class="back"></div></div>
            <div>修改密码</div>
            <div></div>
        </div>
        <div class="mian">
            <div class="password-wrap">
                <div class="weui-cells">
                    <div class="weui-cell">
                        <div class="weui-cell__hd loan-userphone userP-icon"></div>
                        <div class="weui-cell__bd">
                            <span>手机号:</span>
                            <span>${phone }</span>
                            <input class="user-number" type="hidden" value="${phone}" >
                        </div>
                        <div class="weui-cell__ft"></div>
                    </div>
                    <div class="weui-cell yan-pos">
                        <div class="weui-cell__hd code-icon userP-icon"></div>
                        <div class="weui-cell__bd">
                            <span>验证码:</span>
                            <input class="input-la code1 user-yan" type="text" oninput="checkyanzhengma()">
                        </div>
                        <div class="right verification-code right-code"><img id="imgObj" src="<%=path%>/validate/validateCode" onclick="changeImg()"/></div>
                        <div class="weui-cell__ft yan-img"></div>
                    </div>
                    <div class="weui-cell yan-pos">
                        <div class="weui-cell__hd sms-icon userP-icon"></div>
                        <div class="weui-cell__bd">
                            <span>短信验证码:</span>
                            <input class="input-la message" type="text">
                            
                        </div>
                        <div class="weui-cell__ft">
                            <div class="sms-code sms-yan weui-btn weui-btn_mini" onclick="getMessage()">获取</div>
                            <div class="right-code sms"></div>
                        </div>
                    </div>
                </div>
                <div class="weui-cells modify-wrap">
                    <div class="weui-cell">
                        <div class="weui-cell__hd sms-icon userP-icon"></div>
                        <div class="weui-cell__bd">
                            <span>密码</span>
                            <input class="input-la password" type="text">
                        </div>
                        
                    </div>
                </div> 
                <div class="modify-btn-wrap">
                    <div class="modify-btn h-btn" onclick="sub()">修改</div>
                </div>  
            </div>
            </div>
        </div>
    </div>
<script type="text/javascript">
    var path="<%=path%>";
    //表单提交
    var flag = true;
    function sub(){
    	if($(".message").val()==""){
    		layer.msg("短信验证码不能为空");
    	}else if(yanzhengma!=$(".message").val()){
    		changeImg();
    		yanzhengma="";
    		layer.msg("短信验证码错误");
    	}else if($(".password").val()==""){
    		layer.msg("密码不能为空");
    	}else{	
    		if(flag){
    			flag = false;
    			$.ajax({
    			   url:path+"/member/updatePwd.html",
    			   data:{
    				  password : $(".password").val(), 
    			   },
    			   type:"POST",
    			   dataType : "json",
    			   async: false,
    			   success : function(datas) {
                        flag=true;                      
                        layer.msg(datas.msg);                   
                    }
    			});
    		}
    	}
    }
    
    $('.back').on('click', function () {
        window.location= path+"/member/memberMessage.html";
    });
</script>
</body>
</html>
